using UniversalAdmin.Domain.Entities;

namespace UniversalAdmin.Domain.Repositories
{
    /// <summary>
    /// 刷新令牌仓储接口
    /// </summary>
    public interface IRefreshTokenRepository : IRepository<RefreshToken>
    {
        /// <summary>
        /// 根据令牌值获取刷新令牌
        /// </summary>
        /// <param name="token">令牌值</param>
        /// <returns>刷新令牌</returns>
        Task<RefreshToken?> GetByTokenAsync(string token);

        /// <summary>
        /// 获取用户的所有有效刷新令牌
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>有效的刷新令牌列表</returns>
        Task<IEnumerable<RefreshToken>> GetValidTokensByUserIdAsync(int userId);

        /// <summary>
        /// 清理过期的刷新令牌
        /// </summary>
        /// <returns></returns>
        Task CleanupExpiredTokensAsync();
    }
}
